/**
 * 用于检测玩家的碰撞
 */
cc.Class({
    extends: cc.Component,

    properties: {

    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this._player = this.node.parent.getComponent('Player');
        cc.director.getCollisionManager().enabled = true;
    },

    start () {

    },

    // update (dt) {},

    onCollisionEnter (other, self) {
        if (other.tag == 2) {
            
        }
        switch(other.tag){
            case 2:
                //检测到了碰撞敌人
                this._player.die();
                break;
            case 3:
                //护盾
                other.node.parent.parent.removeComponent('Enemy');
                other.node.destroy();

                this._player.openShield();
                break;
        }
    }
});
